const empsRows = [
  // prettier-ignore
  { RowId: '001', EmpId: '10', Lastname: 'Smith', Firstname: 'Joe', Salary: 40000 },
  // prettier-ignore
  { RowId: '002', EmpId: '12', Lastname: 'Jones', Firstname: 'Mary', Salary: 50000 },
  // prettier-ignore
  { RowId: '003', EmpId: '11', Lastname: 'Johnson', Firstname: 'Cathy', Salary: 44000 },
  // prettier-ignore
  { RowId: '004', EmpId: '22', Lastname: 'Jones', Firstname: 'Bob', Salary: 55000 },
  // prettier-ignore
  { RowId: '005', EmpId: '24', Lastname: 'Steve', Firstname: 'Mike', Salary: 62000 },
];

const empsColumns = {
  RowId: ['001', '002', '003', '004', '005'],
  EmpId: ['10', '12', '11', '22', '24'],
  Lastname: ['Smith', 'Jones', 'Johnson', 'Jones', 'Steve'],
  Firstname: ['Joe', 'Mary', 'Cathy', 'Bob', 'Mike'],
  Salary: [40000, 50000, 44000, 55000, 62000],
};

const w = empsColumns.Salary.reduce(gcd) * 10;
const W = empsColumns.Salary.map(s => Math.floor(s / w));

const salaryAnalysis = reduceByKey(
  W.map(W_i => [W_i, 1]),
  (sum, W_i) => sum + W_i
);

const groupedNames = mapValues(
  groupBy(
    empsColumns.Salary.map(s => Math.floor(s / w)).map((W_i, i) => ({
      w: W_i,
      name: `${empsColumns.Firstname[i]} ${empsColumns.Lastname[i]}`,
    })),
    'w'
  ),
  'name'
);
